﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ServiceAgent;
using DataContracts;

namespace TrainingWorkshop.MVPWebsite.Role.Services
{
    public class RoleService : Role.Interface.Services.IRoleService
    {
        ServiceAgent.ServiceAgent proxy = new ServiceAgent.ServiceAgent();

        public List<StatusDTO> GetAllRoleStatus()
        {
            return proxy.ServiceClient.GetAllRoleStatus();
        }

        public List<RoleViewDTO> SearchRole(string roleName, string status, string authorities, string sortExpression, string sortDirection, double PageSize, int PageIndex, out int pageCnt)
        {
            return proxy.ServiceClient.SearchRole(roleName, status, authorities, sortExpression, sortDirection, PageSize, PageIndex, out  pageCnt);
        }


        public RoleDTO GetRoleById(int roleId)
        {
            return proxy.ServiceClient.GetRoleById(roleId);
        }

        public void UpdateRole(RoleDTO role)
        {
            proxy.ServiceClient.UpdateRole(role);
        }

        public void AddNewRole(RoleDTO role)
        {
            proxy.ServiceClient.AddNewRole(role);
        }

        public List<AuthorityDTO> GetAllAuthority()
        {
            return proxy.ServiceClient.GetAllAuthority();
        }


        public List<RoleDTO> GetAllRole(string roleName, int status)
        {
            return proxy.ServiceClient.GetAllRole(roleName, status);
        }

        public void DeleteRole(int roleId)
        {
            proxy.ServiceClient.DeleteRole(roleId);
        }

        public void BatchUpdateRoleStatus(List<RoleDTO> roleList)
        {
            proxy.ServiceClient.BatchUpdateRoleStatus(roleList);
        }

        public StatusDTO GetRoleStatusById(int statusId)
        {
            return proxy.ServiceClient.GetRoleStatusById(statusId);
        }



    }
}
